import 'dart:convert';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:light_image/api/TestReqModel.dart';
import 'package:light_image/commom/commom.dart';
import 'package:light_image/widget/view/web_view_page.dart';

class WorksPage extends StatefulWidget {
  WorksPage({Key key, this.title}) : super(key: key);
  final String title;
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<WorksPage> {
  @override
  void initState() {
    super.initState();
  }
  void _incrementCounter() {
    var url = 'https://lizhanqi.gitee.io/mysite/AppUseIndex/useindex.html';
    url = 'https://www.ixigua.com/';
    routePush(new WebViewPage(url, '未知'));

  }
  void loadData()async{
      final Map data = await TestReqModel().data();
      setState(() {
      if (data != null && data.isNotEmpty) {
       var text=         data["appVersion"];
        print('--------------------------------------');
        print(data);
        print('--------------------------------------');
      }else{
       var a= new Image.asset('images/aaa.png',width: 500,height: 500); 
       var   text="失败咯";

      }
      });
  }

  //相当于xml页面构建
  @override
  Widget build(BuildContext context) {
         return  Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        MaterialButton(
          onPressed: () {
            loadData();
          },
          child: new Text("作品"),
        ),
      ],
    );

  }
}
